Skip to content

feat: Migrates the control-replacement sample.#1192

Open
willum070 wants to merge 4 commits intomainfrom
migrate-control-replacement
Open

feat: Migrates the control-replacement sample.#1192
willum070 wants to merge 4 commits intomainfrom
migrate-control-replacement

Conversation

@willum070
Copy link
Collaborator

@willum070 willum070 commented Mar 11, 2026

This PR does the following things:

  • Migrates the control-replacement sample to js-api-samples.
  • Updates the sample to use the gmp-map element and dynamic library loading.
  • Refactors the entire sample to use modern patterns.
  • Refactors for improved type safety.
  • Refactors the sample to use addEventListener instead of onclick.
  • Refactors the UI to use slotting instead of .push().

@snippet-bot
Copy link

snippet-bot bot commented Mar 11, 2026

Here is the summary of changes.

You are about to add 3 region tags.

This comment is generated by snippet-bot.
If you find problems with this result, please file an issue at:
https://github.com/googleapis/repo-automation-bots/issues.
To update this comment, add snippet-bot:force-run label or use the checkbox below:

  • Refresh this comment

@willum070 willum070 requested a review from jeantimex March 11, 2026 16:10
@willum070 willum070 requested a review from jeantimex March 12, 2026 20:00
Copy link

@jeantimex jeantimex left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Much cleaner code now, thank you!

'.zoom-control-out'
) as HTMLButtonElement;

zoomInButton?.addEventListener('click', () => {

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

do we need the "?" here?

'.maptype-control-satellite'
) as HTMLButtonElement;

btnMap?.addEventListener('click', () => {

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

do we need "?" here?

innerMap.setMapTypeId('roadmap');
});

btnSatellite?.addEventListener('click', () => {

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ditto.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants